from typing import List


class Solution:
    def evalRPN(self, tokens: List[str]) -> int:
        stack = []

        for t in tokens:
            # if t in ('+','-','*','/'):
            if t == "+":
                stack.append(stack.pop() + stack.pop())
            elif t == "-":
                tmp = stack.pop()
                stack.append(stack.pop() - tmp)
            elif t == "*":
                stack.append(stack.pop() * stack.pop())
            elif t == "/":
                tmp = stack.pop()
                stack.append(int(stack.pop() / tmp))
            else:
                stack.append(int(t))
        return stack[-1]


if __name__ == "__main__":
    res = Solution().evalRPN(
        ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]
    )
    print(res)